package homework.mid_autumn_festival.string_exercise;

public class MatchsDemo {
    public static void main(String[] args) {
        /*
            邮箱格式：
            [a-zA-Z0-9]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
         */
        String str = "wwwtedu.cn";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";

        boolean match = str.matches(regex);
        System.out.println(match);
        if (match){
            System.out.println("是正确的邮箱格式");
        }else {
            System.out.println("不是正确的邮箱格式");
        }
    }
}
